package com.twm.interceptor;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @ClassName InterceptorConfig
 * @Description TODO
 * @Author twm17
 * @Date 2020/8/12 15:21
 * @Version 1.0
 */

@Configuration
public class MInterceptorConfig implements WebMvcConfigurer {

    @Bean
    public TimeOutInterceptor getTimeOutInterceptor() {
        return new TimeOutInterceptor();
    }
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        InterceptorRegistration timeRegistry = registry.addInterceptor(getTimeOutInterceptor());
        timeRegistry.addPathPatterns("/**");
    }
}
